package com.xuecheng.system.convert;

import com.xuecheng.api.system.model.dto.CourseCategoryDTO;
import com.xuecheng.api.system.model.dto.DictionaryDTO;
import com.xuecheng.system.entity.Dictionary;
import com.xuecheng.system.entity.ext.CourseCategoryTreeNode;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author wuyunyun
 * @data 2021/10/8 13:29
 */
@Mapper
public interface CourseCategoryConvert {

    CourseCategoryConvert INSTANCE = Mappers.getMapper(CourseCategoryConvert.class);

    @Mappings(
            {
                    @Mapping(source = "id" ,target = "courseCategoryId"),
                    @Mapping(source = "childrenTreeNodes",target = "categoryTreeNodes")
            }
    )
    CourseCategoryDTO treeNode2dto(CourseCategoryTreeNode treeNode);

    List<CourseCategoryDTO> treeNodes2dtos(List<CourseCategoryTreeNode> treeNodes);
}
